#include "REG52.H"
sbit DI  = P3^4;
sbit SFR = P3^6;
sbit STR = P3^5;

int arr[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
void delay(int x)
{
    while (x--);
}
void fun(unsigned int n)
{
    int i = 0;
    for (i = 0; i < 8; i++)
    {
        DI = n>>7;
        n <<= 1;
        SFR = 0;
        delay(50);
        SFR = 1;
        delay(50);
    }
        STR = 0;
        delay(50);
        STR = 1;
        delay(50);
}
int main()
{
    int j = 0;
    P0  = 0x00;
    while (1)
    {
        for ( j = 0; j < 8; j++)
        {
            fun(0x00);
            fun(arr[j]); 
            delay(50000);
        }   
    }
    
    return 0;
}

